<template>
  <div class="group2">
    <h2>数据列表</h2>
    <div>
      <!-- 网格布局 -->
      <div class="grid-box container">
        <template v-for="item in props.slist" :key="item.id">
          <slot name="gridBoxItem" v-bind="item">
            <div class="grid-box-item">
              <div class="grid-card">
                <div class="card-heard clearfix">
                  <img src="" alt="" />
                  <div class="card-head-text float-right">
                    <div class="card-title">{{ item.title }}</div>
                    <div class="card-icon">
                      <img src="" alt="" />
                      <span>用户{{ item.user }}</span>
                    </div>
                    <div class="card-message">
                      {{ item.descript }}
                    </div>
                  </div>
                </div>
                <div class="card-footer clearfix">
                  <div class="footer-index float-left"></div>
                  <button class="grid-btn float-right">开始互动</button>
                </div>
              </div>
            </div>
          </slot>
        </template>
        <!-- <div class="grid-box-item">
          <div class="grid-card">
            <div class="card-heard clearfix">
              <img src="" alt="" />
              <div class="card-head-text float-right">
                <div class="card-title">Chat GPT4.5</div>
                <div class="card-icon">
                  <img src="" alt="" />
                  <span>用户74140114885</span>
                </div>
                <div class="card-message">
                  1,可处理多达4万字的长篇内容 2,具备分析图像的能力，且有一定的「幽默感」 3,生成网页
                  4,超强推理能力 5,可以实时获取网络信息 6，具有超强的信息处理能力
                </div>
              </div>
            </div>
            <div class="card-footer clearfix">
              <div class="footer-index float-left"></div>
              <button class="grid-btn float-right">开始互动</button>
            </div>
          </div>
        </div>
         -->
      </div>
    </div>

    <hr />
    <hr />
    <p>爷爷给的吃的：{{ props.chide }}</p>
    <h2>加载的sonsondemo1</h2>
    <div>
      <SonSonDemo1 :chide2="props.chide"></SonSonDemo1>
    </div>
  </div>
</template>

<script setup lang="ts">
import { type IDemo5List } from '@/service/types/stuDemo5'
import { watchEffect } from 'vue'
import SonSonDemo1 from './SonSonDemo1.vue'

const props = defineProps<{
  slist: IDemo5List[]
  chide: string
}>()

watchEffect(() => {
  console.log(props.slist)
})
</script>

<style lang="scss" scoped>
.group2 {
  border: 2px solid rgb(111, 203, 50);
  margin: 10px;
  padding: 10px;
}

/* #region  网格布局 */

.grid-box {
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.grid-box-item {
  border-radius: 5px;
  cursor: pointer;
}

.grid-card {
  padding: 16px;
  background-color: #fff;
  box-shadow:
    0 15px 35px -2px rgba(0, 0, 0, 0.05),
    0 5px 15px 0 rgba(0, 0, 0, 0.05);
}

.card-heard {
  height: 136px;
  display: flex;
}

.card-heard > img {
  float: left;
  width: 60px;
  height: 60px;
  margin-right: 12px;
  border-radius: 5px;
  vertical-align: middle;
}

.card-head-text {
}

.card-title {
  height: 22px;
  margin-bottom: 8px;
  font-size: 18px;
}

.card-icon {
  height: 20px;
  margin-bottom: 8px;
}

.card-icon img {
  width: 16px;
  height: 16px;
  border-radius: 16px;
}

.card-icon span {
  color: #8a919f;
  font-size: 13px;
}

.card-message {
  height: 44px;
  color: #515767;
  font-size: 13px;
  line-height: 22px;
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
  word-wrap: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-footer {
  height: 34px;
  padding-top: 12px;
  border-top: 1px solid #eaedf1;
}

.footer-index {
  width: 97px;
  height: 21px;
  background-color: palegoldenrod;
}

.grid-btn {
  border: 1px solid #b3d5ff;
  border-radius: 4px;
  padding: 2px 24px;
  color: #1e80ff;
  background-color: #f4f9ff;
  font-size: 12px;
  font-weight: 500;
}

/* #endregion 网格布局 */
</style>
